//
//  CXCustomerNavigationBar.m
//  ProjectOfBStage
//
//  Created by cuixin on 15/11/14.
//  Copyright © 2015年 cuixin. All rights reserved.
//

#import "CXCustomerNavigationBar.h"

@implementation CXCustomerNavigationBar
-(void)dealloc{
    [_backButton release];
    [_titleLabe release];
    [_playButton release];
    [_backButton release];
    [_segment release];
    [super dealloc];
}
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

-(void)createView{
    self.backView = [[UIView alloc] initWithFrame:self.frame];
    self.backView.backgroundColor = [UIColor blackColor];
    


    [self addSubview:self.backView];
    
    
    self.backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.backButton.frame = CGRectMake(WIDTH_PRO(10), HEIGHT_PRO(20), WIDTH_PRO(20), HEIGHT_PRO(20));
    [self.backButton setBackgroundImage:[UIImage imageNamed:@"gobackbtn@2x"] forState:UIControlStateNormal];
    [self.backView addSubview:self.backButton];
    
    self.segment = [[UISegmentedControl alloc] initWithItems:@[@"最热", @"最新"]];
    self.segment.frame = CGRectMake(WIDTH_PRO(120), self.backButton.frame.origin.y, WIDTH_PRO(130), self.backButton.frame.origin.y + HEIGHT_PRO(5));
//    self.segment.backgroundColor = [UIColor blackColor];
    self.segment.hidden = YES;
    
    self.self.tintColor = [UIColor blackColor];
    
    self.segment.selectedSegmentIndex = 0;
    [self.backView addSubview:self.segment];
    
    [_segment release];

    
    self.titleLabe = [[UILabel alloc] initWithFrame:CGRectMake(self.backButton.frame.size.width + self.backButton.frame.origin.x + HEIGHT_PRO(70), self.backButton.frame.origin.y, WIDTH_PRO(150), self.backButton.frame.size.height)];
    self.titleLabe.textAlignment = NSTextAlignmentCenter;
    [self.titleLabe setTextColor:[UIColor whiteColor]];
    [self.titleLabe setFont:[UIFont boldSystemFontOfSize:HEIGHT_PRO(15)]];
    [self.backView addSubview:self.titleLabe];
    [_titleLabe release];
    
    self.playButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.playButton.frame = CGRectMake(self.frame.size.width - WIDTH_PRO(40), self.titleLabe.frame.origin.y, WIDTH_PRO(20), self.backButton.frame.size.height);
    [self.playButton setBackgroundImage:[UIImage imageNamed:@"iconfont-yuleguangdie.png"] forState:UIControlStateNormal];
    [self.backView addSubview:self.playButton];
    
    [_backView release];
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
